/**
 * 一年中的第几天
 * @param date
 * @returns
 */
function dayOfYear(date) {
  const [year, month, day] = date.split('-').map((item) => +item)

  const amount = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  if (year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)) {
    ++amount[1]
  }
  let ans = 0
  for (let i = 0; i < month - 1; ++i) {
    ans += amount[i]
  }
  return ans + day
}
